<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="stylesheet" type="text/css" href="/static/h-ui/css/H-ui.css" />
<link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.min.css" />
<script type="text/javascript" src="/static/h-ui/js/jquery-3.6.0.min.js"></script>
<title>修改信息</title>
</head>
<body>

<div class="panel panel-default">
				<div class="panel-header">表单</div>
				<div class="panel-body">
						<div class="row cl">
							<label class="form-label col-xs-3">名字：</label>
							<div class="formControls col-xs-8">
								<input type="text" class="input-text" value="{$content.name}"  name="name" id="name" autocomplete="off">
							</div>
								<div class="col-xs-8 col-xs-offset-3">
								<input type="button" class="btn btn-primary radius" id="translate_btn" value="重新翻译">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-3">中文内容：</label>
							<div class="formControls col-xs-8">
								<textarea cols="" rows="" class="textarea" name="content" id="content"  >{$content.content}</textarea>
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-3">英文名字:</label>
							<div class="formControls col-xs-8">
								<input type="text" class="input-text" value="{$en_content.name}"  name="en_name" id="en_name">
							</div>
						</div>
						<div class="row cl">
							<label class="form-label col-xs-3">英文内容：</label>
							<div class="formControls col-xs-8">
								<textarea class="textarea" rows="" cols="" name="en_content" id="en_content">{$en_content.content}</textarea>
							</div>
						</div>
						
						<div class="row clearfix">
							<label class="form-label col-xs-3">分类：</label>
							<div class="formControls col-xs-8">
								<div class="row clearfix" style="margin-top:0">
									<div class="col-xs-6">
										<span class="select-box">
											<select class="select" size="1" name="city" id="type">
												<option value="" selected>选择分类</option>
												{volist name='cat_list' id='cat'}
					          						<option {eq name="content.type" value="$cat.type_id"} selected{/eq} value="{$cat.type_id}">{$cat.type_name}</option>
					          					{/volist}
											</select>
										</span>
									</div>
							
								</div>
							</div>
						</div>
						<div class="row clearfix">
							<label class="form-label col-xs-3">子分类：</label>
							<div class="formControls col-xs-8">
								<div class="row clearfix" style="margin-top:0">
									<div class="col-xs-6">
										<span class="select-box">
											<select class="select" size="1" name="city" id="type2">
												<option value="0" selected>选择二级分类</option>
												{volist name='sub_cat' id='cat2'}
					          						<option {eq name="content.type2" value="$cat2.type_id"} selected{/eq} value="{$cat2.type_id}">{$cat2.type_name}</option>
					          					{/volist}
											</select>
										</span>
									</div>
							
								</div>
							</div>
						</div>
						<input type="hidden" value={$content.a_id} id="a_id" />
						<div class="row cl">
							<div class="col-xs-8 col-xs-offset-3">
								<input type="button" class="btn btn-primary radius" id="submitbut" value="保存">
							</div>
						</div>
				</div>
</div>
<div class="panel panel-default mt-20">
	<div class="panel-header">图片音频和视频  
	 <input type="button" class="btn btn-primary radius" id="creatimage_btn" value="抓取图片">
	 <input type="button" class="btn btn-primary radius" id="creataudio_btn" value="生成语音">
	 {if condition="($image_count > 0) AND ($audio_count > 0) "} 
	 	<input type="button" class="btn btn-primary radius" id="creatvideo_btn" value="生成视频">
	 {/if}
	 </div>
	<div class="panel-body">
		{gt name="image_count" value="0"}
		<p>
			{volist name='image_list' id='list'}
			<img style="width:140px; height:140px"  src="https://timo-public.oss-cn-shanghai.aliyuncs.com/{$list.oss_key}" alt="..." class="thumbnail">
			{/volist}
			</p>
			{/gt}

	</div>
	{gt name="audio_count" value="0"}
	
		<div>
			中文内容音频:<audio src="https://timo-video.oss-cn-shanghai.aliyuncs.com/{$audio_cn.oss_key}" controls ></audio>	
		</div>
		<div>
			英文内容音频:<audio src="https://timo-video.oss-cn-shanghai.aliyuncs.com/{$audio_en.oss_key}" controls ></audio>	
		</div>
	{/gt}
	
	{gt name="audio_title_count" value="0"}
	
		<div>
			中文title音频:<audio src="https://timo-video.oss-cn-shanghai.aliyuncs.com/{$audio_title_cn.oss_key}" controls ></audio>	
		</div>
		<div>
			英文title音频:<audio src="https://timo-video.oss-cn-shanghai.aliyuncs.com/{$audio_title_en.oss_key}" controls ></audio>	
		</div>
	{/gt}
	{gt name="video_count" value="0"}
		<div>
			中文视频:<video src="https://timo-video.oss-cn-shanghai.aliyuncs.com/{$video_cn.oss_key}" controls ></video>	
		</div>
		<div>
			中文视频:<video src="https://timo-video.oss-cn-shanghai.aliyuncs.com/{$video_en.oss_key}" controls ></video>	
		</div>
	{/gt}
</div>
</body>

<script type="text/javascript">
		$("#submitbut").click(function(){
			
			$("#submitbut").attr("disabled",true);
			var name = $("#name").val();
			var content = $("#content").val();
			var en_name = $("#en_name").val();
			var en_content = $("#en_content").val();
			var type = $("#type").val();
			var type2 = $("#type2").val();
			var a_id = $("#a_id").val();
			 $.post("/save/"+a_id,{"name":name,"en_name":en_name,"content":content,"en_content":en_content,"type":type,"type2":type2},function(result){
				    if(result=="sucess"){
				    	alert("保存成功");
				    	window.location.reload()
				    }
				  });
		});
		
		
	
		$("#translate_btn").click(function(){
			$("#translate_btn").attr("disabled",true);
			var name = $("#name").val();
			var content = $("#content").val();
			var a_id = $("#a_id").val();
			 $.post("/ts",{"name":name,"content":content,"a_id":a_id},function(data){
				 alert("翻译成功")
				 window.location.reload()
				  });
		});
		
		
		$("#creatimage_btn").click(function(){
			$("#creatimage_btn").attr("disabled",true);
			var a_id = $("#a_id").val();
			$.post("/creatimage",{"a_id":a_id},function(res){
				if(res=="sucess"){
					alert("图片生成成功");
			    	window.location.reload()
				}
		  });
		});
		
		
		$("#creataudio_btn").click(function(){
			$("#creataudio_btn").attr("disabled",true);
			var a_id = $("#a_id").val();
			$.post("/creataudio",{"a_id":a_id},function(res){
				if(res=="sucess"){
					alert("语音生成成功");
			    	window.location.reload()
				}
		  });
		});
		
		$("#creatvideo_btn").click(function(){
			$("#creatvideo_btn").attr("disabled",true);
			var a_id = $("#a_id").val();
			$.post("/createvideo",{"a_id":a_id},function(res){
			
					alert(res);
			    	window.location.reload()
				
		  });
		});
		
$("#type").change(function(){ 
	$("#type2").html('<option value="0" >选择二级分类</option>');
	 var type_id =this.value;
	       


	 $.post("/changetype",{"type_id":type_id},function(res){
		 var dataObj=eval("("+res+")");

		 $.each(dataObj,function(idx,item){
				
			 //html+="<option value='"+item.type_id+"'>"+item.type_name+"</option>";
			 $("#type2").append("<option value='"+item.type_id+"'>"+item.type_name+"</option>");
			 });

	  });
	       
	 });
	</script>
</html>